home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qglobal.h.z / qglobal.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  10.6 KB  |  465 lines

  1. /****************************************************************************
  2. ** $Id: qglobal.h,v 2.56 1998/07/06 15:10:59 agulbra Exp $
  3. **
  4. ** Global type declarations and definitions
  5. **
  6. ** Created : 920529
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QGLOBAL_H
  25. #define QGLOBAL_H
  26.  
  27.  
  28. #define QT_VERSION    140
  29. #define QT_VERSION_STR    "1.40"
  30.  
  31.  
  32. //
  33. // The operating system, must be one of: (_OS_x_)
  34. //
  35. //   MAC    - Macintosh
  36. //   MSDOS    - MS-DOS and Windows
  37. //   OS2    - OS/2
  38. //   OS2EMX    - XFree86 on OS/2 (not PM)
  39. //   WIN32    - Win32 (Windows 95 and Windows NT)
  40. //   SUN    - SunOS
  41. //   SOLARIS    - Sun Solaris
  42. //   HPUX    - HP-UX
  43. //   ULTRIX    - DEC Ultrix
  44. //   LINUX    - Linux
  45. //   FREEBSD    - FreeBSD
  46. //   NETBSD    - NetBSD
  47. //   OPENBSD    - OpenBSD
  48. //   IRIX    - SGI Irix
  49. //   OSF    - OSF Unix
  50. //   BSDI    - BSDI Unix
  51. //   SCO    - SCO of some sort
  52. //   AIX    - AIX Unix
  53. //   UNIXWARE    - SCO UnixWare
  54. //   GNU    - GNU Hurd
  55. //   DGUX    - DG Unix
  56. //   UNIX    - Any UNIX bsd/sysv system
  57. //
  58.  
  59. #if defined(macintosh)
  60. #define _OS_MAC_
  61. #elif defined(MSDOS) || defined(_MSDOS) || defined(__MSDOS__)
  62. #define _OS_MSDOS_
  63. #elif defined(OS2) || defined(_OS2) || defined(__OS2__)
  64. #if defined(__EMX__)
  65. #define _OS_OS2EMX_
  66. #else
  67. #define _OS_OS2_
  68. #endif
  69. #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
  70. #define _OS_WIN32_
  71. #elif defined(sun) || defined(__sun) || defined(__sun__)
  72. #define _OS_SUN_
  73. #if defined(_OS_SUN_) && defined(__SVR4)
  74. #define _OS_SOLARIS_
  75. #undef _OS_SUN_
  76. #endif
  77. #elif defined(hpux) || defined(__hpux) || defined(__hpux__)
  78. #define _OS_HPUX_
  79. #elif defined(ultrix) || defined(__ultrix) || defined(__ultrix__)
  80. #define _OS_ULTRIX_
  81. #elif defined(linux) || defined(__linux) || defined(__linux__)
  82. #define _OS_LINUX_
  83. #elif defined(__FreeBSD__)
  84. #define _OS_FREEBSD_
  85. #elif defined(__NetBSD__)
  86. #define _OS_NETBSD_
  87. #elif defined(__OpenBSD__)
  88. #define _OS_OPENBSD_
  89. #elif defined(sgi) || defined(__sgi)
  90. #define _OS_IRIX_
  91. #elif defined(__osf__)
  92. #define _OS_OSF_
  93. #elif defined(bsdi) || defined(__bsdi__)
  94. #define _OS_BSDI_
  95. #elif defined(_SCO_DS) || defined(M_UNIX) || defined(M_XENIX)
  96. #define _OS_SCO_
  97. #elif defined(_AIX)
  98. #define _OS_AIX_
  99. #elif defined(__Lynx__)
  100. #define _OS_LYNXOS_
  101. #elif defined(_UNIXWARE)
  102. #define _OS_UNIXWARE_
  103. #elif defined(__GNU__)
  104. #define _OS_GNU_
  105. #elif defined(DGUX)
  106. #define _OS_DGUX_
  107. #elif defined(sco)
  108. #define _OS_UNIXWARE7
  109. #else
  110. #error "Qt has not been ported to this OS - talk to qt-bugs@troll.no"
  111. #endif
  112.  
  113. #if !defined(UNIX)
  114. #define UNIX
  115. #endif
  116. #if defined(_OS_MAC_) || defined(_OS_MSDOS_) || defined(_OS_OS2_) || defined(_OS_WIN32_)
  117. #undef    UNIX
  118. #endif
  119.  
  120.  
  121. //
  122. // The compiler, must be one of: (_CC_x_)
  123. //
  124. //   SYM    - Symantec C++ for both PC and Macintosh
  125. //   MPW    - MPW C++
  126. //   METROWERKS - Metroworks C++
  127. //   MSVC    - Microsoft Visual C/C++
  128. //   BOR    - Borland/Turbo C++
  129. //   WAT    - Watcom C++
  130. //   GNU    - GNU C++
  131. //   COMEAU    - Comeau C++
  132. //   EDG    - Edison Design Group C++
  133. //   OC        - CenterLine ObjectCenter C++
  134. //   SUN    - Sun C++
  135. //   DEC    - DEC C++
  136. //   HP        - HPUX C++
  137. //   USLC    - SCO UnixWare C++
  138. //
  139.  
  140. #if defined(__SC__)
  141. #define _CC_SYM_
  142. #elif defined(applec)
  143. #define _CC_MPW_
  144. #elif defined(__MWERKS__)
  145. #define _CC_METROWORKS_
  146. #define HAS_BOOL_TYPE
  147. #elif defined(_MSC_VER)
  148. #define _CC_MSVC_
  149. #elif defined(__BORLANDC__) || defined(__TURBOC__)
  150. #define _CC_BOR_
  151. #elif defined(__WATCOMC__)
  152. #define _CC_WAT_
  153. #elif defined(__GNUC__)
  154. #define _CC_GNU_
  155. #elif defined(__xlC__)
  156. #define _CC_XLC_
  157. #elif defined(como40)
  158. #define _CC_EDG_
  159. #define _CC_COMEAU_
  160. #elif defined(__EDG) || defined(__EDG__)
  161. // one observed on SGI DCC, the other documented
  162. #define _CC_EDG_
  163. #elif defined(OBJECTCENTER) || defined(CENTERLINE_CLPP)
  164. #define _CC_OC_
  165. #elif defined(__SUNPRO_CC)
  166. #define _CC_SUN_
  167. #elif defined(__DECCXX)
  168. #define _CC_DEC_
  169. #elif defined(__USLC__)
  170. #define _CC_USLC_
  171. #elif defined(_OS_HPUX_)
  172. // this test from from aCC online help
  173. #if __cplusplus >= 199707L
  174. // this is the aCC
  175. #define _CC_HP_ACC_
  176. #define HAS_BOOL_TYPE
  177. #else
  178. // this is the CC
  179. #define _CC_HP_
  180. #endif // __cplusplus >= 199707L
  181. #else
  182. #error "Qt has not been tested with this compiler - talk to qt-bugs@troll.no"
  183. #endif
  184.  
  185. #if defined(_CC_COMEAU_)
  186. #define Q_C_CALLBACKS
  187. #endif
  188.  
  189.  
  190. //
  191. // Specify to use macro or template classes (if not set from cmd line)
  192. //
  193.  
  194. #define USE_MACROCLASS                /* always use macro classes */
  195. #define USE_TEMPLATECLASS            /* use template classes */
  196.  
  197.  
  198. //
  199. // Some compilers do not support templates
  200. //
  201.  
  202. #if defined(_CC_MPW_) || (defined(_CC_MSVC_) && _MSC_VER < 900)
  203. #define NO_TEMPLATECLASS
  204. #endif
  205.  
  206. #if defined(NO_TEMPLATECLASS)
  207. #undef    USE_TEMPLATECLASS            /* templates not wanted */
  208. #endif
  209.  
  210.  
  211. //
  212. // Smart setting/checking of DEFAULT_ flag
  213. //
  214.  
  215. #if !defined(DEFAULT_MACROCLASS) && !defined(DEFAULT_TEMPLATECLASS)
  216. #if defined(USE_TEMPLATECLASS)
  217. #define DEFAULT_TEMPLATECLASS
  218. #else
  219. #define DEFAULT_MACROCLASS
  220. #endif
  221. #endif
  222.  
  223. #if !defined(USE_TEMPLATECLASS) && defined(DEFAULT_TEMPLATECLASS)
  224. #error "Can't use templates as default when USE_TEMPLATECLASS is not defined!"
  225. #endif
  226.  
  227. #if defined(DEFAULT_MACROCLASS) && defined(DEFAULT_TEMPLATECLASS)
  228. #error "Define DEFAULT_MACROCLASS or DEFAULT_TEMPLATECLASS, not both!"
  229. #endif
  230.  
  231.  
  232. //
  233. // Useful type definitions for Qt
  234. //
  235.  
  236. #if defined(bool)
  237. #define HAS_BOOL_TYPE
  238. #elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6)
  239. #define HAS_BOOL_TYPE
  240. #elif _MSC_VER >= 1100 || __BORLANDC__ >= 0x500
  241. #define HAS_BOOL_TYPE
  242. #elif defined(_CC_COMEAU_)
  243. #define HAS_BOOL_TYPE
  244. #elif defined(sgi) && ( (_COMPILER_VERSION >= 710) || defined(_BOOL) )
  245. #define HAS_BOOL_TYPE
  246. #elif defined(__DECCXX) && (__DECCXX_VER >= 60060005)
  247. #define HAS_BOOL_TYPE
  248. #endif
  249.  
  250. #if !defined(HAS_BOOL_TYPE)
  251. #if defined(_CC_MSVC_)
  252. #define _CC_BOOL_DEF_
  253. #define bool        int
  254. #else
  255. typedef int        bool;
  256. #endif
  257. #endif
  258.  
  259. typedef unsigned char    uchar;
  260. typedef unsigned short    ushort;
  261. typedef unsigned    uint;
  262. typedef unsigned long    ulong;
  263. typedef char           *pchar;
  264. typedef uchar           *puchar;
  265. typedef const char     *pcchar;
  266.  
  267.  
  268. //
  269. // Constant bool values
  270. //
  271.  
  272. #ifndef TRUE
  273. const bool FALSE = 0;
  274. const bool TRUE = !0;
  275. #endif
  276.  
  277.  
  278. //
  279. // Utility macros and inline functions
  280. //
  281.  
  282. #define QMAX(a,b)    ((a) > (b) ? (a) : (b))
  283. #define QMIN(a,b)    ((a) < (b) ? (a) : (b))
  284. #define QABS(a)        ((a) >= 0  ? (a) : -(a))
  285.  
  286. inline int qRound( double d )
  287. {
  288.     return d > 0.0 ? int(d+0.5) : int(d-0.5);
  289. }
  290.  
  291.  
  292. //
  293. // Size-dependent types (architechture-dependent byte order)
  294. //
  295.  
  296. #if !defined(QT_CLEAN_NAMESPACE)
  297. typedef char        INT8;            // 8 bit signed
  298. typedef unsigned char    UINT8;            // 8 bit unsigned
  299. typedef short        INT16;            // 16 bit signed
  300. typedef unsigned short    UINT16;            // 16 bit unsigned
  301. typedef int        INT32;            // 32 bit signed
  302. typedef unsigned int    UINT32;            // 32 bit unsigned
  303. #endif
  304.  
  305. typedef char        Q_INT8;            // 8 bit signed
  306. typedef unsigned char    Q_UINT8;        // 8 bit unsigned
  307. typedef short        Q_INT16;        // 16 bit signed
  308. typedef unsigned short    Q_UINT16;        // 16 bit unsigned
  309. typedef int        Q_INT32;        // 32 bit signed
  310. typedef unsigned int    Q_UINT32;        // 32 bit unsigned
  311.  
  312.  
  313. //
  314. // Data stream functions is provided by many classes (defined in qdatastream.h)
  315. //
  316.  
  317. class QDataStream;
  318.  
  319.  
  320. //
  321. // System information
  322. //
  323.  
  324. const char *qVersion();
  325. bool qSysInfo( int *wordSize, bool *bigEndian );
  326.  
  327.  
  328. //
  329. // Debugging and error handling
  330. //
  331.  
  332. #if !defined(NO_CHECK)
  333. #define CHECK_STATE                // check state of objects etc.
  334. #define CHECK_RANGE                // check range of indexes etc.
  335. #define CHECK_NULL                // check null pointers
  336. #define CHECK_MATH                // check math functions
  337. #endif
  338.  
  339. #if !defined(NO_DEBUG) && !defined(DEBUG)
  340. #define DEBUG                    // display debug messages
  341. #endif
  342.  
  343. //
  344. // To get C++ compiler warnings, define CC_WARNINGS or comment out the line
  345. // "#define NO_WARNINGS"
  346. //
  347.  
  348. #if !defined(CC_WARNINGS)
  349. #define NO_WARNINGS
  350. #endif
  351. #if defined(NO_WARNINGS)
  352. #if defined(_CC_MSVC_)
  353. #pragma warning(disable: 4244)
  354. #pragma warning(disable: 4800)
  355. #elif defined(_CC_BOR_)
  356. #pragma option -w-inl
  357. #pragma warn -inl
  358. #pragma warn -pia
  359. #pragma warn -ccc
  360. #pragma warn -rch
  361. #pragma warn -sig
  362. #endif
  363. #endif // NO_WARNINGS
  364.  
  365. //
  366. // Avoid compiler warning "argument defined but not used"
  367. //
  368.  
  369. #if !defined(NOT_USED)
  370. #define NOT_USED(argument) argument=argument;
  371. #endif
  372.  
  373. //
  374. // Avoid dead code
  375. //
  376.  
  377. #if defined(_CC_EDG_) || defined(_CC_WAT_)
  378. #define NO_DEADCODE
  379. #endif
  380.  
  381. //
  382. // Avoid compiler warning "function defined but not used" (gcc only)
  383. //
  384.  
  385. #if defined(NOT_USED_FN)
  386. // user provided
  387. #elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
  388. #define NOT_USED_FN __attribute__ ((unused))
  389. #else
  390. #define NOT_USED_FN
  391. #endif
  392.  
  393. //
  394. // Avoid "char ident[54] defined but not used" for the RCS tag
  395. //
  396.  
  397. #if !defined(DEBUG)
  398. #define RCSTAG(string)
  399. #elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
  400. #define RCSTAG(string) static char ident[] __attribute__ ((unused)) = string
  401. #elif defined(_CC_DEC_) || defined(_CC_COMEAU_)
  402. #define RCSTAG(string) typedef int QUnusedSemicolon
  403. #else
  404. #define RCSTAG(string)
  405. #endif
  406.  
  407. void debug( const char *, ... )            // print debug message
  408. #if defined(_CC_GNU_)
  409.     __attribute__ ((format (printf, 1, 2)))
  410. #endif
  411. ;
  412.  
  413. void warning( const char *, ... )        // print warning message
  414. #if defined(_CC_GNU_)
  415.     __attribute__ ((format (printf, 1, 2)))
  416. #endif
  417. ;
  418.  
  419. void fatal( const char *, ... )            // print fatal message and exit
  420. #if defined(_CC_GNU_)
  421.     __attribute__ ((format (printf, 1, 2)))
  422. #endif
  423. ;
  424.  
  425. #if defined(QT_FATAL_ASSERT)
  426. #define ASSERT(x)  if ( !(x) )\
  427.     fatal("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__)
  428. #else
  429. #define ASSERT(x)  if ( !(x) )\
  430.     warning("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__)
  431. #endif
  432.  
  433. bool chk_pointer( bool c, const char *, int );    // fatal error if c is TRUE
  434.  
  435. #if defined(CHECK_NULL)
  436. #define CHECK_PTR(p) (chk_pointer((p)==0,__FILE__,__LINE__))
  437. #else
  438. #define CHECK_PTR(p)
  439. #endif
  440.  
  441. enum QtMsgType { QtDebugMsg, QtWarningMsg, QtFatalMsg };
  442.  
  443. typedef void (*msg_handler)(QtMsgType, const char *);
  444. msg_handler qInstallMsgHandler( msg_handler );    // install message handler
  445.  
  446.  
  447. //
  448. // Enable QT_ADD_GENERIC_MACROS unless QT_REJECT_OBSOLETE is defined
  449. //
  450. #if !defined(QT_REJECT_OBSOLETE)
  451. #define QT_ADD_GENERIC_MACROS
  452. #endif
  453.  
  454. void qSuppressObsoleteWarnings( bool = TRUE );
  455.  
  456. #if !defined(QT_REJECT_OBSOLETE)
  457. #define QT_OBSOLETE
  458. void qObsolete( const char *obj, const char *oldfunc, const char *newfunc );
  459. void qObsolete( const char *obj, const char *oldfunc );
  460. void qObsolete( const char *message );
  461. #endif
  462.  
  463.  
  464. #endif // QGLOBAL_H
  465.